x86/VT-x: Dump VMCS on VMLAUNCH/VMRESUME failure
authorAndrew Cooper <andrew.cooper3@citrix.com>
Thu, 30 Jun 2016 20:00:01 +0000 (21:00 +0100)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Mon, 4 Jul 2016 09:51:48 +0000 (10:51 +0100)
If a VMLAUNCH/VMRESUME fails due to invalid control or host state, dump the
VMCS before crashing the domain.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Kevin Tian <kevin.tian@intel.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
xen/arch/x86/hvm/vmx/vmcs.c
xen/include/asm-x86/hvm/vmx/vmcs.h

index 46b63b60f66de5d34d4dc68df406ce69a5e1dd21..1bd875ad08caba5ca16ead5fec59770d57926036 100644 (file)
@@ -1637,6 +1637,11 @@ void vmx_vmentry_failure(void)
     __vmread(VM_INSTRUCTION_ERROR, &error);
     gprintk(XENLOG_ERR, "VM%s error: %#lx\n",
             curr->arch.hvm_vmx.launched ? "RESUME" : "LAUNCH", error);
+
+    if ( error == VMX_INSN_INVALID_CONTROL_STATE ||
+         error == VMX_INSN_INVALID_HOST_STATE )
+        vmcs_dump_vcpu(curr);
+
     domain_crash_synchronous();
 }
 
index 9f1729d6ef01230e20141bf7319667ecb826d437..1e33d9c19541370f676f783d1a48ef81f9b5069d 100644 (file)
@@ -567,6 +567,10 @@ enum vmcs_field {
 #define VMX_GUEST_MSR 0
 #define VMX_HOST_MSR  1
 
+/* VM Instruction error numbers. */
+#define VMX_INSN_INVALID_CONTROL_STATE       7
+#define VMX_INSN_INVALID_HOST_STATE          8
+
 void vmx_disable_intercept_for_msr(struct vcpu *v, u32 msr, int type);
 void vmx_enable_intercept_for_msr(struct vcpu *v, u32 msr, int type);
 int vmx_read_guest_msr(u32 msr, u64 *val);